package com.learn.springcloud.zuuluploadfileconsumer.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Time : 2018/8/9 11:50
 * @Version : 1.0
 */
@RestController
public class HelloController {

    @RequestMapping(value = "/zuul/upload/file/consumer/test/{name}")
    public String test(@PathVariable String name){
        System.out.println(name);
        return "consumer, " + name;
    }

    @RequestMapping(value = "/zuul/upload/file/consumer/test1")
    public String test1(@RequestParam("file")MultipartFile multipartFile){
        String filename = multipartFile.getOriginalFilename();
        long fileSize = multipartFile.getSize();
        return filename + " : " + fileSize;
    }
}
